package com.hanbang.taitaigou.utils.db;

import com.hanbang.taitaigou.R;

import org.xutils.DbManager;
import org.xutils.x;

public class DbUtil {
    private static DbManager dbManager;

    public static DbManager getDbUtils() {
        if (dbManager == null) {
            DbManager.DaoConfig daoConfig = new DbManager.DaoConfig();
            daoConfig.setDbName(x.app().getString(R.string.app_name));
            daoConfig.setDbVersion(3);
            dbManager = getDbUtils(daoConfig);
            return dbManager;
        } else {
            return dbManager;
        }
    }

    private static DbManager getDbUtils(DbManager.DaoConfig daoConfig) {
        daoConfig.setAllowTransaction(true);
        DbManager dbManager = x.getDb(daoConfig);
        return dbManager;
    }

}
